// components/tab-control/tab-control.js
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        titles: {
            type: Array,
            value: [],
        }
    },
    externalClasses: ['external-classes'],
    data: {
        name: 'tab-control',
        currentIndex: 0,
    },
    /**
     * 组件的方法列表
     */
    methods: {
        onTitleTap(event) {
            const { index } = event.mark;
            this.setData({
                currentIndex: index,
            })
            this.triggerEvent('tab-item-tap', { currentIndex: index })
        },
        test(index) {
            console.log('父page调用组件test方法', index);
            this.setData({
                currentIndex: index
            })
        }
    }
})